package com.sjms._05_创建_建造者;

/**
 * 建造者实现类
 */
public class JBCarBuilder extends AbstractCarBuilder {

    /**
     * 安装 底盘
     */
    @Override
    JBCarBuilder buildChassis(String str) {
        this.car.chassis = str;
        return this;
    }

    /**
     * 安装 车身
     */
    @Override
    JBCarBuilder buildBody(String str) {
        this.car.body = str;
        return this;

    }

    /**
     * 安装 车轮
     */
    @Override
    JBCarBuilder buildWheel(String str) {
        this.car.wheel = str;
        return this;

    }

    /**
     * 安装 引擎
     */
    @Override
    JBCarBuilder buildEngine(String str) {
        this.car.engine = str;
        return this;

    }

    /**
     * 安装 其他
     */
    @Override
    JBCarBuilder buildOther(String str) {
        this.car.other = str;
        return this;

    }

    /**
     * 贴 品牌
     */
    @Override
    JBCarBuilder buildBrand(String str) {
        this.car.brand = str;
        return this;
    }

    /**
     * 生成产品
     */
    @Override
    Car build() {
        if (this.car.chassis.equals("未知")) {
            System.out.println("警告：生产失败。失败原因：未安装车身....");
            return null;
        }
        //        ...
        //        ...
        //        ...
        //        ...
        return this.car;
    }

}
